<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
	<head>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/CSS/bootstrap.css" />
		<link href="${pageContext.request.contextPath}/CSS/base.css" rel="stylesheet">
		<link href="${pageContext.request.contextPath}/CSS/animate.min.css" rel="stylesheet">
		<style type="text/css">
      .detail-container{
        background-color: #fff;
        padding: 18px 36px 18px 36px;
      }


      .detail-title{
        margin-bottom: 36px;
        text-align: center;
        color: rgba(0,0,0,0.87);
      }

      .comment-container{
        width: 100%;
        margin-top: 36px;
      }

      .comment-post{
        min-width: 100%;
        max-width: 100%;
        height: 200px;
        max-height: 200px;
      }

      .comment-summit{
        margin-top: 5px;
        right:0px;
        bottom: 0px;
      }

      .comment-others{
        background-color: #eeeeee;
        margin-top: 36px;
      }

      .comment-someone-img-container{
        height: 40px;
        text-align: center;
        line-height: 40px;
      }

      .commment-someone{
        padding: 15px;
      }

      .comment-someone-content{
          margin-left: 15px;
      }

      .clear-padding{
        padding: 0px;
      }
		</style>
    <title>图片分享社区 - 详情</title>
  </head>

  <body>
   <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container" >
        <div class="navbar-header">
          <a class="navbar-brand" href="fonthead.action">
						<span class="nav-title">图片分享社区</span>
					</a>
        </div>

        <div id="navbar" class="navbar-collapse collapse" >
          <div class="navbar-form navbar-right">
						<li class="dropdown" >
			        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
								<s:if test="#session.IMG==null">
								<img class="img-circle" style="height: 40px;" src="${pageContext.request.contextPath}/IMG/headimg.jpg">
							</s:if>
							<s:else>
							<img class="img-circle" style="height: 40px;" src='<s:property value="#session.IMG"/>'>
							</s:else>
							</a>
							
						<s:if test="#session.ID==null">
			        <ul class="dropdown-menu">
			         <li><a href="loginfont.action">登陆</a></li>
			           <li role="separator" class="divider"></li>
			           <li><a href="registerpage.action">注册</a></li>
			
			  
			        </ul>
			        </s:if>
			        <s:else>
			         <ul class="dropdown-menu">
                   <li><a href="userprofile.action?id=<s:property value="#session.ID"/>">个人主页</a></li>
			          <li role="separator" class="divider"></li>
			          <li><a href="alelterpassword.action">修改密码</a></li>
			           <li role="separator" class="divider"></li>
			          <li><a href="logoutfont.action">注销</a></li>
			        </ul>
			        </s:else>
			      </li>
          </div>
        </div>
      </div>
    </nav>

    <div class="container main-body animated slideInLeft">
  
      <div class="detail-container">
        <s:iterator value="sharelist" id="share">
        <div class="detail-title">
          <h2><s:property value="#share.title"/></h2>
          <div class="row">
          <div class="col-md-3">
          <span ><span class="glyphicon glyphicon-user" aria-hidden="true"></span>分享者：<s:property value="#share.username"/></span>
          </div>
            <div class="col-md-3">
          <span><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>分享时间：<s:property value="#share.sharetime"/></span>
      </div>
           <div class="col-md-3">
          <span><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>点赞数：<s:property value="#share.likecount"/></span>
             </div>
              <div class="col-md-3">
              <span><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>浏览数：<s:property value="#share.watchcount"/></span>
         </div>
        
        </div>
        </div>

        <div>
        <img src='<%=path%><s:property value="#share.imagpath"/>' class="img-thumbnail img-responsive"  style="width: 100%">         
        </div>
<div class="well">
<p class="text-muted"><s:property value="#share.content"/></p>
</div>
</s:iterator>
<br/>
<br/>
<s:iterator value="sharelist" id="share">
        <div class="comment-container">
          <div>
          <form id="forms" onsubmit="return check()" action="commtentfont.action?id=<s:property value="#share.id"/>&userid=<s:property value="#session.ID"/>" method="post">
            <textarea class="form-control comment-post" rows="1" placeholder="发表评论" id="comments" name="comment.content" style="height:100px;" ></textarea>
            <button type="submit" class="btn btn-info comment-summit pull-right" id="submit">发表评论</button>
            <br/>
            </form>
          </div>
        </div>
</s:iterator>
<s:if test="commentlist.size()==0">
<br/>
<br/>
<h3 style="text-align:center">暂无评论,马上发表评论,做第一个评论的人</h3>

</s:if>
<s:else>
 <s:iterator value="commentlist" id="comment">
        <div class="comment-others">
          <div>
         
            <div class="commment-someone">
              <div class="row">
                <div class="col-md-1 comment-someone-img-container">
                  <img class="img-circle" style="height:100%" src="<s:property value="#comment.headimg"/>">
                </div>
                <div class="col-md-11 clear-padding">
                  <div>
                    <div><s:property value="#comment.username"/></div>
                    <div><s:property value="#comment.commenttime"/></div>
                  </div>
                </div>
              </div>
              <div class="comment-someone-content">
                <h3><s:property value="#comment.content"/></h3>
              </div>
            </div>
        

          </div>
        </div>
        </s:iterator>
        </s:else>
    <hr/>
      </div>
    </div>
    <!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center;">操作提示</h4>
      </div>
      <div class="modal-body">
                     <h5 style="text-align:center;">评论内容不能为空！！！</h5>
      </div>
      <div class="modal-footer">
    
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
    		<!--footer-->
<footer>
    <div class="container" style="text-align:center">
        <div class="row">
            <div class="col-md-12">
                <p>
                    Copyright&nbsp;©&nbsp;2012-2015&nbsp;&nbsp;www.sharephoto.com&nbsp;&nbsp;粤ICP备13014270号-4
              
                </p>
            </div>
        </div>
    </div>
</footer>
<!--footer-->
<script src="${pageContext.request.contextPath}/JS/jquery-1.12.3.min.js"></script>
<script src="${pageContext.request.contextPath}/JS/bootstrap.min.js"></script>
<script type="text/javascript">
//进行前断校验


 function check(){
   if($("#comments").val().trim()==""){
   $("#myModal").modal("show");
   return false;
   }else{
  return true; 
   }
  };

</script>
  </body>
</html>
